<template>
  <div class="personal">
      <personal-header></personal-header>
      <personal-content :personalList1="personalList1" :personalList2="personalList2" :personalList3="personalList3"></personal-content>
      <personal-nav :navList="navList"></personal-nav>
  </div>
</template>

<script>
import axios from 'axios'
import PersonalHeader from './components/PersonalHeader'
import PersonalContent from './components/PersonalContent'
import PersonalNav from './components/PersonalNav'
export default {
  name: 'Personal',
  data () {
    return {
        personalList1:[],
        personalList2:[],
        personalList3:[],
        navList:[]
    }
  },
  components:{
    PersonalHeader,
    PersonalContent,
    PersonalNav
  },
  mounted(){
    this.getHomeInfo()
  },
  methods:{
    getHomeInfo(){
        // axios返回的结果是一个promise对象
        axios.get('/shopping_mall/index.php/Home/Personal/index').then(
        // 注意：这里绝对不可以写成this.getHomeInfoSucc（），否则请求的结果会是undefined
        this.getHomeInfoSucc
      )
    },
    getHomeInfoSucc(res){
        // console.log(res)
        res = res.data 
        // console.log(res)
        if(res.ret && res.data){
          this.personalList1 = res.data.personalList1
          this.personalList2 = res.data.personalList2
          this.personalList3 = res.data.personalList3
          this.navList = res.data.navList
        }
    }
  }
}
</script>


<style lang="stylus" scoped>
.personal 
    background-color #efefef
</style>
